﻿using System;
using Budget.Silver.View;

namespace Budget.Silver.Core.Services.Impl
{
    public class DialogService : IDialogService
    {
        public int Width { get; set; }
        public int Height { get; set; }
        public void Show(string title, string message, Action<bool?> onClosedCallback)
        {
            var confirmation = new ConfirmationView(message)
                {
                    Width = Width, 
                    Height = Height,
                    Title = title,
                    
                };
            confirmation.Closed += (s, e) =>
                {
                    if (onClosedCallback != null)
                    {
                        var result = confirmation.DialogResult;
                        onClosedCallback(result);
                    }
                };
            confirmation.Show();
        }
    }
}